import { Message } from 'element-ui'

// type success/warning/info/error
export function message(message, type, time, offset = 20) {
  Message({
    message: message,
    type: type,
    duration: time,
    offset: offset,
    showClose: true
  })
}

export function showSuccessMsg(message = '操作成功!') {
  Message({
    message: message,
    type: 'success',
    duration: 2 * 1000
  })
}

export function showErrorMsg(message = '操作失败!') {
  Message({
    message: message,
    type: 'error',
    duration: 2 * 1000
  })
}

export function showWarningMsg(message = '') {
  Message({
    message: message,
    type: 'warning',
    duration: 2 * 1000
  })
}

export function showInfoMsg(message = '') {
  Message({
    message: message,
    type: 'info',
    duration: 2 * 1000
  })
}
